﻿using System.ComponentModel;
using CozeDomain.Base;
using FreeSql.DataAnnotations;

namespace CozeDomain.Entities
{
    /// <summary>
    /// 用户模型
    /// </summary>
    [Table(Name = "User")]
    [Description("用户")]
    public class UserEntity : BaseTenantsEntity
    {
        /// <summary>
        /// 手机号
        /// </summary>
        [Column(DbType = "varchar", StringLength = 20, IsNullable = false)]
        [Description("手机号")]
        public string? Phone { get; set; }

        /// <summary>
        /// 账号
        /// </summary>
        [Column(DbType = "varchar", StringLength = 18, IsNullable = false)]
        [Description("账号")]
        public string? Account { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        [Column(DbType = "varchar", StringLength = 50, IsNullable = false)]
        [Description("密码")]
        public string? Pwd { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        [Column(DbType = "mediumtext", IsNullable = true)]
        [Description("头像")]
        public string? Avatar { get; set; }

        /// <summary>
        /// 昵称
        /// </summary>
        [Column(DbType = "varchar", StringLength = 30, IsNullable = true)]
        [Description("昵称")]
        public string? NickName { get; set; }

        /// <summary>
        /// 微信账户
        /// </summary>
        [Column(DbType = "varchar", StringLength = 30, IsNullable = true)]
        [Description("微信账户")]
        public string? WeChartAccount { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        [Column(DbType = "varchar", StringLength = 30, IsNullable = true)]
        [Description("邮箱")]
        public string? Email { get; set; }

        /// <summary>
        /// 用户类型 (普通用户/分销用户)
        /// </summary>
        [Column(DbType = "varchar", StringLength = 10, IsNullable = false)]
        [Description("用户类型 (普通用户/分销用户)")]
        public string? UserType { get; set; }

        /// <summary>
        /// 分销用户ID
        /// </summary>
        [Column(DbType = "varchar", StringLength = 36, IsIdentity = true)]
        [Description("分销用户ID")]
        public string? SaleUserId { get; set; }

        /// <summary>
        /// 消费额设定
        /// </summary>
        [Column(StringLength = 18, IsNullable = false)]
        [Description("消费额设定")]
        public double? ConsumptionAmountLimit { get; set; }

        /// <summary>
        /// 返现设定
        /// </summary>
        [Column(StringLength = 18, IsNullable = true)]
        [Description("返现设定")]
        public double? CashbackAmountLimit { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [Column(DbType = "varchar", StringLength = 5, IsNullable = true)]
        [Description("性别")]
        public string? Gender { get; set; }

        /// <summary>
        /// 生日
        /// </summary>
        [Column(DbType = "varchar", StringLength = 10, IsNullable = true)]
        [Description("生日")]
        public string? Birthday { get; set; }

        /// <summary>
        /// 地区
        /// </summary>
        [Column(DbType = "varchar", StringLength = 30, IsNullable = true)]
        [Description("地区")]
        public string? Region { get; set; }

        /// <summary>
        /// 签名
        /// </summary>
        [Column(DbType = "varchar", StringLength = 500, IsNullable = true)]
        [Description("签名")]
        public string? Signature { get; set; }

        /// <summary>
        /// 微信收款二维码设定（针对分销员）
        /// </summary>
        [Column(DbType = "mediumtext", IsNullable = true)]
        [Description("收款二维码设定（针对分销员）")]
        public string? WxQrCode { get; set; }

        /// <summary>
        /// 支付宝收款二维码设定（针对分销员）
        /// </summary>
        [Column(DbType = "mediumtext", IsNullable = true)]
        [Description("支付宝收款二维码设定（针对分销员）")]
        public string? AlipayQrCode { get; set; }

        /// <summary>
        /// 分销链接（offlne根据申请沟通，沟通后后台变更用户类型为分销员，该用户前端UI即可看见分销链接
        /// </summary>
        [Column(DbType = "varchar", StringLength = 50, IsNullable = true)]
        [Description("分销链接（offlne根据申请沟通，沟通后后台变更用户类型为分销员，该用户前端UI即可看见分销链接")]
        public string? SalesLink { get; set; }

        /// <summary>
        /// 账户金额
        /// </summary>
        [Column(DbType = "double", StringLength = 18, IsNullable = false)]
        [Description("账户金额")]
        public double? Balance { get; set; }

        /// <summary>
        /// 上次登录时间
        /// </summary>
        [Column(DbType = "dateTime", IsNullable = true)]
        [Description("上次登录时间")]
        public DateTime? LastLoginTime { get; set; }

        /// <summary>
        /// 上次登录IP地址 
        /// </summar
        [Column(DbType = "varchar", StringLength = 20, IsNullable = true)]
        [Description("上次登录IP地址")]
        public string? LastLoginIp { get; set; }

        /// <summary>
        /// 登录总次数
        /// </summary>
        [Column(DbType = "int", IsNullable = true)]
        [Description("登录总次数")]
        public int? LoginTotalCount { get; set; }

        /// <summary>
        /// 描述
        /// </summary>
        [Column(DbType = "varchar", StringLength = 500, IsNullable = true)]
        [Description("描述")]
        public string? Description { get; set; }

        /// <summary>
        /// 状态
        /// </summary>
        [Column(DbType = "bit", IsNullable = false)]
        [Description("状态")]
        public bool? Status { get; set; }
    }
}
